<%@page import="java.util.*"%>
<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="UTF-8"%>
<%@ page import="java.sql.*"%>
<%@ page import="org.json.simple.JSONObject"%>
<%@ page import="org.json.simple.JSONArray"%>
<%@ page import="java.net.URLEncoder"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	request.setCharacterEncoding("UTF-8");
	String memail1 = request.getParameter("memail");
	String memail2 = request.getParameter("memail2");
	String mpassword = request.getParameter("mpassword");
	
	String mname = request.getParameter("mname");
	String mnickname = request.getParameter("mnickname");
	String msex = request.getParameter("msex");
	String mbirth = request.getParameter("mbirth");

	String picode = request.getParameter("picode");
	
	//String memail1 = "dike818@hanmail.net";
	//String memail2 = "chaesj@hanmail.net";
	//String mpassword = "akakak111";
	
	//String mname = "이경제";
	//String mnickname = "abc123";
	//String msex = "B";
	//String mbirth = request.getParameter("mbirth");
	//String mbirth = "1982918";

	String url = "jdbc:oracle:thin:@192.168.0.18:1521:orcl";
	String user = "book";
	String password = "book";
	String sql = null;

	Connection conn = null;
	ResultSet rs = null;

	PreparedStatement stmt=null;

	//JSONObject jsonMain = new JSONObject();
	//JSONObject obj = new JSONObject();
	//JSONArray arr = new JSONArray();

	try {
		Class.forName("oracle.jdbc.driver.OracleDriver");

		conn = DriverManager.getConnection(url, user, password);

		sql = "INSERT INTO MEMBER (MCODE,MEMAIL1,MEMAIL2,MPASSWORD,PICODE,MNAME,MNICKNAME,MSEX,MBIRTH,MDATE) VALUES ( 'M'||SEQ_MEMBER.NEXTVAL,?,?,?,?,?,?,?,?,TO_CHAR(SYSDATE, 'yyyymmdd'))";

		stmt = conn.prepareStatement(sql);

		stmt.setString(1, memail1);
		stmt.setString(2, memail2);
		stmt.setString(3, mpassword);
		stmt.setString(4, picode);
		stmt.setString(5, mname);
		stmt.setString(6, mnickname);
		stmt.setString(7, msex);
		stmt.setString(8, mbirth);

		//		rs = stmt.executeQuery();
		stmt.executeUpdate();
		
		out.println("등록성공");
	} catch (Exception e) {
		e.printStackTrace();
	} finally {

		if (stmt != null)
	stmt.close();
		if (conn != null)
	conn.close();

	}
%>



